<script type="text/html" id="tpl_show_menu">
    <style type="text/css">
        .diymenu .item .inner {background: <%style.bgcolor%>;}
        .diymenu .item .inner:before,
        .diymenu .item .inner:after {border-color: <%style.bordercolor%>;}
        .diymenu .item .inner .text {color: <%style.textcolor%>;}
        .diymenu .item .inner .icon {color: <%style.iconcolor%>;}
        .diymenu .item.on .inner {background: <%style.bgcoloron%>;}
        .diymenu .item.on .inner .text {color: <%style.textcoloron%>;}
        .diymenu .item.on .inner .icon {color: <%style.textcoloron%>;}
        .diymenu .item .child {border-color: <%style.childbordercolor%>; background-color: <%style.childbgcolor%>;}
        .diymenu .item .child a {color: <%style.childtextcolor%>;}
        .diymenu .item .child a:after {border-color: <%style.childbordercolor%>; color: <%style.childtextcolor%>;}
        .diymenu .item .child .arrow:before {background: <%style.childbordercolor%>;}
        .diymenu .item .child .arrow:after {background: <%style.childbgcolor%>;}
        .diymenu .item .inner .imgTextDefault{display: inline-block!important}
        .diymenu .item .inner .imgTextSelect{display: none!important;}
        .diymenu .item:nth-of-type(1) .inner .imgTextDefault{display: none!important;}
        .diymenu .item:nth-of-type(1) .inner .imgTextSelect{display: inline-block!important;}
       .diymenu .item:nth-of-type(1) .inner .text{color: <%style.textcoloron%>;}
        .diymenu .item:nth-of-type(1) .inner .icon{color: <%style.iconcoloron%>;}
    </style>
    <div class="diymenu-page" style="background: #f9f9f9;">菜单最多添加五个 <i class="icon icon-icondownload"></i> </div>
    <div class="diymenu" style="width:100%;">
        <%each data as item%>
            <div class="item item-col-<%count(data)%>" <!--<%if count(item.child)>0 && params.navstyle==0%>onclick="showSubMenu(this)"<%else%>onclick="window.open('<%item.linkurl%>')"<%/if%>-->>
                <div class="inner <%if params.navstyle==1 ||  params.navstyle == 2%>image<%/if%>">
                    <%if params.navstyle==0%>
                        <%if item.iconclass%>
                            <span class="icon <%item.iconclass%> <%params.navfloat%>"></span>
                        <%/if%>
                        <span style="font-size:<%params.fontSiz%>px" class="text <%params.navfloat%>" <%if item.iconclass==''%>style="margin-top: 10px; font-size: 14px;"<%/if%>><%item.text%></span>
                    <%/if%>
                    <%if params.navstyle==1%>
                        <img src="<%imgsrc item.imgurl%>"/>
                    <%/if%>
                    <%if params.navstyle==2%>
                        <img src="<%imgsrc item.default_img%>" class="imgTextDefault" style="height: 60%;"/>
                        <img src="<%imgsrc item.select_img%>" class="imgTextSelect" style="height: 60%;"/>
                        <span class="text" style="font-size:<%params.fontSiz%>px"><%item.text%></span>
                    <%/if%>
                </div>
                <%if count(item.child)>0 && params.navstyle==0%>
                    <div class="child">
                        <%each item.child as child%>
                            <a href="<%child.linkurl%>"><%child.text%></a>
                        <%/each%>
                        <span class="arrow"></span>
                    </div>
                <%/if%>
            </div>
        <%/each%>
    </div>

</script>

<script type="text/html" id="tpl_edit_menu">

    <div class="form-group">
        <div class="col-sm-2 control-label">菜单名称</div>
        <div class="col-sm-9">
            <input class="form-control diy-bind" data-bind="name" data-placeholder="未命名自定义菜单" placeholder="请输入名称" value="<%name%>">
            <div class="help-block">注意：菜单名称是便于后台查找。</div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-2 control-label">图标样式</div>
        <div class="col-sm-9">
            <label class="radio-inline"><input type="radio" name="navstyle" value="0" class="diy-bind" data-bind-child="params" data-bind="navstyle" data-bind-init="true" <%if params.navstyle==0%>checked="checked"<%/if%>> 图标+文字</label>
            <label class="radio-inline"><input type="radio" name="navstyle" value="1" class="diy-bind" data-bind-child="params" data-bind="navstyle" data-bind-init="true" <%if params.navstyle==1%>checked="checked"<%/if%>> 图片</label>
            <label class="radio-inline"><input type="radio" name="navstyle" value="2" class="diy-bind" data-bind-child="params" data-bind="navstyle" data-bind-init="true" <%if params.navstyle==2%>checked="checked"<%/if%>> 图片+文字</label>
            <div class="help-block">提示：图片样式时不支持二级菜单</div>
        </div>
    </div>
    <div class="line"></div>
    <div class="form-group">
        <div class="col-sm-2 control-label">背景颜色</div>
        <div class="col-sm-9" <%if params.navstyle==1%>style="width: 210px"<%/if%>>
            <div class="input-group">
                <span class="input-group-addon">默认</span>
                <input class="form-control diy-bind color" type="color" data-bind-child="style" data-bind="bgcolor" value="<%style.bgcolor%>" />
                <span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#ffffff').trigger('propertychange')">清除</span>
            </div>
        </div>
    </div>
    <%if params.navstyle==0 || params.navstyle==2%>
        <%if params.navstyle==0%>
            <div class="form-group">
                <div class="col-sm-2 control-label">图标颜色</div>
                <div class="col-sm-9">
                    <div class="input-group">
                        <span class="input-group-addon">默认</span>
                        <input class="form-control diy-bind color" type="color" data-bind-child="style" data-bind="iconcolor" value="<%style.iconcolor%>" />
                        <span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#999999').trigger('propertychange')">清除</span>
                        <span class="input-group-addon" style="border-left: 0;">选中</span>
                        <input class="form-control diy-bind color" type="color" data-bind-child="style" data-bind="iconcoloron" value="<%style.iconcoloron%>" />
                        <span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#999999').trigger('propertychange')">清除</span>
                    </div>
                </div>
            </div>
        <%/if%>
        <div class="form-group">
            <div class="col-sm-2 control-label">文字颜色</div>
            <div class="col-sm-9">
                <div class="input-group">
                    <span class="input-group-addon">默认</span>
                    <input class="form-control diy-bind color" type="color" data-bind-child="style" data-bind="textcolor" value="<%style.textcolor%>" />
                    <span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#666666').trigger('propertychange')">清除</span>
                    <span class="input-group-addon" style="border-left: 0;">选中</span>
                    <input class="form-control diy-bind color" type="color" data-bind-child="style" data-bind="textcoloron" value="<%style.textcoloron%>" />
                    <span class="input-group-addon btn btn-default" onclick="$(this).prev().val('#666666').trigger('propertychange')">清除</span>
                </div>
            </div>
        </div>
		<div class="form-group">
		    <div class="col-sm-2 control-label">文字大小</div>
		    <div class="col-sm-9">
		        <label class="radio-inline"><input type="radio" name="fontSiz" value="13" class="diy-bind" data-bind-child="style" data-bind="fontSiz" data-bind-init="true" checked="checked">13px</label>
		        <label class="radio-inline"><input type="radio" name="fontSiz" value="14" class="diy-bind" data-bind-child="style" data-bind="fontSiz" data-bind-init="true" <%if style.fontSiz==14%>checked="checked"<%/if%>>14px</label>
		        <label class="radio-inline"><input type="radio" name="fontSiz" value="15" class="diy-bind" data-bind-child="style" data-bind="fontSiz" data-bind-init="true" <%if style.fontSiz==15%>checked="checked"<%/if%>>15px</label>
		    </div>
		</div>
    <%/if%>
    <div class="line"></div>
    <div class="form-items indent" data-min="1" data-max="5">
        <div class="inner" id="form-items">
            <%each data as item itemid %>
            <div class="item" data-id="<%itemid%>">
                <span class="btn-del del-item" title="删除"></span>
                <div class="item-body">
                    <div class="item-image <%if params.navstyle==0%>square<%/if%>">
                        <%if params.navstyle==1%>
                            <img src="<%imgsrc item.imgurl%>" onerror="this.src='{IMAGE_NOPIC_SMALL}'" id="pimg-<%itemid%>" style="background: #fff;" />
                        <%/if%>
                        <%if params.navstyle==0%>
                            <span class="btn-del" title="清空图标" onclick="$('#cicon-<%itemid%>').val('').trigger('change')"></span>
                            <div class="icon-main">
                                <%if item.iconclass!=''%>
                                    <span class="icon <%item.iconclass%>" id="picon-<%itemid%>"></span>
                                <%else%>
                                    <p>无图标</p>
                                <%/if%>
                            </div>
                            <div class="text goods-selector" data-toggle="selectIcon" data-input="#cicon-<%itemid%>" data-element="#picon-<%itemid%>">选择图标</div>
                            <input type="hidden" id="cicon-<%itemid%>" class="diy-bind" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="iconclass" data-bind-init="true" />
                        <%/if%>
                        <%if params.navstyle==2%>
                            <!--默认图片-->
                            <div class="item-image <%if params.navstyle==0%>square<%/if%>">
                                <div class="icon-main">
                                    <img src="<%imgsrc item.default_img%>" onerror="this.src='{IMAGE_NOPIC_SMALL}'" id="pimg-<%itemid%>" style="background: #fff;" />
                                </div>
                                <span class="text goods-selector" data-toggle="selectAttachment" data-input="#cimg-<%itemid%>" data-img="#pimg-<%itemid%>">默认图片</span>
                                <input type="hidden" class="form-control diy-bind" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="default_img" id="cimg-<%itemid%>" value="<%item.default_img%>" />
                            </div>
                        <%/if%>
                    </div>
                    <%if params.navstyle==2%>
                        <!--选中图片-->
                        <div class="item-image <%if params.navstyle==0%>square<%/if%>">
                            <div class="icon-main">
                                <img src="<%imgsrc item.select_img%>" onerror="this.src='{IMAGE_NOPIC_SMALL}'" id="pimg-<%itemid%>S" style="background: #fff;" />
                            </div>
                            <span class="text goods-selector" data-toggle="selectAttachment" data-input="#cimg-<%itemid%>S" data-img="#pimg-<%itemid%>S">选中图片</span>
                            <input type="hidden" class="form-control diy-bind" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="select_img" id="cimg-<%itemid%>S"  value="<%item.select_img%>" />
                        </div>
                    <%/if%>
                    <div class="item-form">
                        <div class="input-group" style="margin-bottom:0px; ">
                            <%if params.navstyle==0 ||params.navstyle==2%>
                                <span class="input-group-addon">文字</span>
                                <input type="text" class="form-control diy-bind" value="<%item.text%>" placeholder="留空则不显示文字" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="text" />
                                <input type="hidden" class="diy-bind" id="cimg-<%itemid%>" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="imgurl" />
                            <%/if%>
                            <%if params.navstyle==1%>
                                <input type="text" class="form-control diy-bind" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="imgurl" id="cimg-<%itemid%>" placeholder="请选择图片或输入图片地址" value="<%item.imgurl%>" />
                                <span class="input-group-addon btn btn-default" data-toggle="selectAttachment" data-input="#cimg-<%itemid%>" data-img="#pimg-<%itemid%>">选择图片</span>
                            <%/if%>
                        </div>
                        <div class="input-group" style="margin-top:10px; margin-bottom:0px; ">
                            <input type="text" class="form-control diy-bind" readonly="readonly" data-bind-parent="<%itemid%>" data-bind-child="data" data-bind="linkurl" id="curl-<%itemid%>" placeholder="请选择链接或输入链接地址" value="<%item.linkurl%>" />
                            <span class="input-group-addon btn btn-default" data-toggle="selectUrl" data-input="#curl-<%itemid%>">选择链接</span>
                        </div>
                    </div>
                </div>
            </div>
            <%/each%>
        </div>
        <div class="btn btn-w-m btn-block btn-default btn-outline" id="addItem"><i class="fa fa-plus"></i> 添加一个</div>
    </div>
</script>

